FROM python:3.7-stretch
LABEL maintainer="CXFHKJ <cxfh@vip.sina.com>"

USER root
ENV TZ=Asia/Shanghai
ENV HOST=0.0.0.0
ENV LOG_LEVEL=info
ENV WORKERS_PER_CORE=2

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y

RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

VOLUME ["/uploads", "/logs"]
EXPOSE 8080

COPY ./core /app/core/
COPY ./dao /app/dao/
COPY ./model /app/model/
COPY ./wxenterprise /app/wxenterprise/
COPY ./wxpublic /app/wxpublic/
COPY ./background_scheduler.py /app/
COPY ./deploy_app.py /app/app.py
COPY ./authenticate.py /app/
COPY ./gps_transform.py /app/
COPY ./setup_log.py /app/
COPY ./config.py /app/
COPY ./deploy_config.env /app/config.env
COPY ./database.py /app/
COPY ./gunicorn_config.py /app/
COPY ./redis_connection.py /app/
COPY ./request_method.py /app/
COPY ./requirements.txt /app/
COPY ./timed_task.py /app/
COPY ./timed_task_pro.py /app/
COPY ./token_manage.py /app/
COPY ./utils.py /app/
COPY ./wx_msg_process.py /app/
COPY ./start.sh /start.sh
RUN chmod +x /start.sh

WORKDIR /app/
RUN python -m pip install --upgrade pip
RUN pip install -r requirements.txt

CMD ["/start.sh"]